{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Particle Swarm Optimisation for Graph Neural Network Architecture Search\n",
    "\n",
    "> - Final Project of Course: Convex Optimisation\n",
    "> - Haowei Xu, iOPEN, CS Master, 2022205230"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Library"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Env Info: 3.8.13 (default, Mar 28 2022, 11:38:47) \n",
      "[GCC 7.5.0]\n",
      "{'BATCH_SIZE': 64,\n",
      " 'DATA_DIR': 'data',\n",
      " 'DEVICE': 'cuda:0',\n",
      " 'DROPOUT': 0.5,\n",
      " 'EPOCHS': 100,\n",
      " 'EVALUATION_METRIC': 'accuracy',\n",
      " 'EXP': 'Cora',\n",
      " 'HIDDEN_DIM_LB': 2,\n",
      " 'HIDDEN_DIM_UB': 64,\n",
      " 'HIDDEN_NUM_LB': 2,\n",
      " 'HIDDEN_NUM_UB': 16,\n",
      " 'LEARNING_RATE_LB': 0.01,\n",
      " 'LEARNING_RATE_UB': 0.0001,\n",
      " 'LOGS_DIR': 'logs',\n",
      " 'NUM_INFORMANTS': 4,\n",
      " 'NUM_PARTICLES': 16,\n",
      " 'PATIENCE_TRESHOLD': 8,\n",
      " 'PERCENT': 0.2,\n",
      " 'PRINT_FREQ': 4,\n",
      " 'ROOT': '/home/hwxu/Projects/SIGN/',\n",
      " 'SEED': 52,\n",
      " 'SHUFFLE': True,\n",
      " 'STYLE': ['science', 'ieee', 'grid', 'muted'],\n",
      " 'WORKERS': 32}\n",
      "0号显卡当前剩余现存：98.70%\n",
      "1号显卡当前剩余现存：26.53%\n",
      "应选择0号显卡\n"
     ]
    }
   ],
   "source": [
    "from main import main  # main function\n",
    "from lib.utils.choose_device import choose_optimal_device\n",
    "from lib.utils.get_config import get_cfg\n",
    "import warnings\n",
    "import matplotlib.pyplot as plt # visualization\n",
    "from pprint import pprint\n",
    "import sys\n",
    "import os.path as osp  # misc\n",
    "\n",
    "warnings.filterwarnings(\"ignore\") # suppress warnings\n",
    "print(f'Env Info: {sys.version}') # exp environment\n",
    "\n",
    "cfg = get_cfg(osp.join(osp.abspath(\"./\"), 'configs/config.yaml')) # read config file\n",
    "pprint(cfg)\n",
    "\n",
    "plt.style.use(cfg['STYLE']) # set visual style\n",
    "\n",
    "cfg['DEVICE'] = f'cuda:{choose_optimal_device(2)}' # set optimal gpu\n",
    "\n",
    "\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Experiment"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cora"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-----Current Experiment: Cora-----\n",
      "   name  num_classes  num_features  num_edge_features  num_node_features\n",
      "0  Cora            7          1433                  0               1433\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e3d72567a5094835b5938739b29fde91",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/100 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch = 1/100\tLoss: 0.726\tAccuracy: 0.871\n",
      "Epoch = 5/100\tLoss: 0.223\tAccuracy: 0.845\n",
      "Epoch = 9/100\tLoss: 0.095\tAccuracy: 0.859\n",
      "Epoch = 13/100\tLoss: 0.180\tAccuracy: 0.832\n",
      "Epoch = 17/100\tLoss: 0.244\tAccuracy: 0.841\n",
      "Epoch = 21/100\tLoss: 0.115\tAccuracy: 0.852\n",
      "Epoch = 25/100\tLoss: 0.080\tAccuracy: 0.841\n",
      "Epoch = 29/100\tLoss: 0.032\tAccuracy: 0.844\n",
      "Epoch = 33/100\tLoss: 0.178\tAccuracy: 0.848\n",
      "Epoch = 37/100\tLoss: 0.096\tAccuracy: 0.844\n",
      "Epoch = 41/100\tLoss: 0.322\tAccuracy: 0.852\n",
      "Epoch = 45/100\tLoss: 0.802\tAccuracy: 0.849\n",
      "Epoch = 49/100\tLoss: 0.645\tAccuracy: 0.852\n",
      "Epoch = 53/100\tLoss: 0.365\tAccuracy: 0.869\n",
      "Epoch = 57/100\tLoss: 0.217\tAccuracy: 0.843\n",
      "Epoch = 61/100\tLoss: 0.361\tAccuracy: 0.847\n",
      "Epoch = 65/100\tLoss: 0.568\tAccuracy: 0.863\n",
      "Epoch = 69/100\tLoss: 0.614\tAccuracy: 0.861\n",
      "Epoch = 73/100\tLoss: 0.205\tAccuracy: 0.860\n",
      "Epoch = 77/100\tLoss: 0.428\tAccuracy: 0.791\n",
      "Epoch = 81/100\tLoss: 0.175\tAccuracy: 0.849\n",
      "Epoch = 85/100\tLoss: 0.010\tAccuracy: 0.843\n",
      "Epoch = 89/100\tLoss: 0.276\tAccuracy: 0.862\n",
      "Epoch = 93/100\tLoss: 0.176\tAccuracy: 0.851\n",
      "Epoch = 97/100\tLoss: 0.313\tAccuracy: 0.852\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>epoch</th>\n",
       "      <th>loss</th>\n",
       "      <th>accuracy</th>\n",
       "      <th>average_loss</th>\n",
       "      <th>average_accuracy</th>\n",
       "      <th>best_particle_hidden_num</th>\n",
       "      <th>best_particle_hidden_dim</th>\n",
       "      <th>best_particle_lr</th>\n",
       "      <th>best_err</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.725854</td>\n",
       "      <td>0.871</td>\n",
       "      <td>1.043801</td>\n",
       "      <td>0.569000</td>\n",
       "      <td>2.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0.000900</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.211933</td>\n",
       "      <td>0.833</td>\n",
       "      <td>1.045911</td>\n",
       "      <td>0.558187</td>\n",
       "      <td>4.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0.007694</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.206939</td>\n",
       "      <td>0.838</td>\n",
       "      <td>1.150888</td>\n",
       "      <td>0.497188</td>\n",
       "      <td>4.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.006490</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.251121</td>\n",
       "      <td>0.861</td>\n",
       "      <td>1.295223</td>\n",
       "      <td>0.459562</td>\n",
       "      <td>2.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>0.002331</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.222618</td>\n",
       "      <td>0.845</td>\n",
       "      <td>1.721003</td>\n",
       "      <td>0.252312</td>\n",
       "      <td>4.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>0.005071</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>95.0</td>\n",
       "      <td>0.320501</td>\n",
       "      <td>0.841</td>\n",
       "      <td>1.346037</td>\n",
       "      <td>0.456438</td>\n",
       "      <td>3.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.001429</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>96.0</td>\n",
       "      <td>0.312909</td>\n",
       "      <td>0.852</td>\n",
       "      <td>1.401873</td>\n",
       "      <td>0.429625</td>\n",
       "      <td>3.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0.003048</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>97.0</td>\n",
       "      <td>0.029566</td>\n",
       "      <td>0.841</td>\n",
       "      <td>1.325466</td>\n",
       "      <td>0.432000</td>\n",
       "      <td>2.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.004946</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>98.0</td>\n",
       "      <td>0.142106</td>\n",
       "      <td>0.837</td>\n",
       "      <td>1.427875</td>\n",
       "      <td>0.393062</td>\n",
       "      <td>3.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>0.005561</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99.0</td>\n",
       "      <td>0.187799</td>\n",
       "      <td>0.849</td>\n",
       "      <td>1.506152</td>\n",
       "      <td>0.359750</td>\n",
       "      <td>3.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0.005056</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    epoch      loss  accuracy  average_loss  average_accuracy  \\\n",
       "0     0.0  0.725854     0.871      1.043801          0.569000   \n",
       "1     1.0  0.211933     0.833      1.045911          0.558187   \n",
       "2     2.0  0.206939     0.838      1.150888          0.497188   \n",
       "3     3.0  0.251121     0.861      1.295223          0.459562   \n",
       "4     4.0  0.222618     0.845      1.721003          0.252312   \n",
       "..    ...       ...       ...           ...               ...   \n",
       "95   95.0  0.320501     0.841      1.346037          0.456438   \n",
       "96   96.0  0.312909     0.852      1.401873          0.429625   \n",
       "97   97.0  0.029566     0.841      1.325466          0.432000   \n",
       "98   98.0  0.142106     0.837      1.427875          0.393062   \n",
       "99   99.0  0.187799     0.849      1.506152          0.359750   \n",
       "\n",
       "    best_particle_hidden_num  best_particle_hidden_dim  best_particle_lr  \\\n",
       "0                        2.0                      28.0          0.000900   \n",
       "1                        4.0                      24.0          0.007694   \n",
       "2                        4.0                      50.0          0.006490   \n",
       "3                        2.0                      36.0          0.002331   \n",
       "4                        4.0                      31.0          0.005071   \n",
       "..                       ...                       ...               ...   \n",
       "95                       3.0                      50.0          0.001429   \n",
       "96                       3.0                      24.0          0.003048   \n",
       "97                       2.0                      50.0          0.004946   \n",
       "98                       3.0                      39.0          0.005561   \n",
       "99                       3.0                      20.0          0.005056   \n",
       "\n",
       "    best_err  \n",
       "0        0.0  \n",
       "1        0.0  \n",
       "2        0.0  \n",
       "3        0.0  \n",
       "4        0.0  \n",
       "..       ...  \n",
       "95       0.0  \n",
       "96       0.0  \n",
       "97       0.0  \n",
       "98       0.0  \n",
       "99       0.0  \n",
       "\n",
       "[100 rows x 9 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "main(exp_name=cfg['EXP'])"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Pubmed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-----Current Experiment: PubMed-----\n",
      "     name  num_classes  num_features  num_edge_features  num_node_features\n",
      "0  PubMed            3           500                  0                500\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5a283a28d7334905872d539cface7cfc",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/100 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch = 1/100\tLoss: 0.113\tAccuracy: 0.836\n",
      "Epoch = 5/100\tLoss: 0.827\tAccuracy: 0.710\n",
      "Epoch = 9/100\tLoss: 0.265\tAccuracy: 0.825\n",
      "Epoch = 13/100\tLoss: 0.210\tAccuracy: 0.821\n",
      "Epoch = 17/100\tLoss: 0.395\tAccuracy: 0.820\n",
      "Epoch = 21/100\tLoss: 0.164\tAccuracy: 0.839\n",
      "Epoch = 25/100\tLoss: 0.050\tAccuracy: 0.819\n",
      "Epoch = 29/100\tLoss: 0.136\tAccuracy: 0.835\n",
      "Epoch = 33/100\tLoss: 0.447\tAccuracy: 0.812\n",
      "Epoch = 37/100\tLoss: 0.149\tAccuracy: 0.838\n",
      "Epoch = 41/100\tLoss: 0.350\tAccuracy: 0.820\n",
      "Epoch = 45/100\tLoss: 0.182\tAccuracy: 0.832\n",
      "Epoch = 49/100\tLoss: 0.643\tAccuracy: 0.815\n",
      "Epoch = 53/100\tLoss: 0.237\tAccuracy: 0.833\n",
      "Epoch = 57/100\tLoss: 0.412\tAccuracy: 0.779\n",
      "Epoch = 61/100\tLoss: 0.146\tAccuracy: 0.844\n",
      "Epoch = 65/100\tLoss: 0.625\tAccuracy: 0.826\n",
      "Epoch = 69/100\tLoss: 0.241\tAccuracy: 0.836\n",
      "Epoch = 73/100\tLoss: 0.192\tAccuracy: 0.844\n",
      "Epoch = 77/100\tLoss: 0.262\tAccuracy: 0.811\n",
      "Epoch = 81/100\tLoss: 0.138\tAccuracy: 0.836\n",
      "Epoch = 85/100\tLoss: 0.421\tAccuracy: 0.806\n",
      "Epoch = 89/100\tLoss: 0.265\tAccuracy: 0.823\n",
      "Epoch = 93/100\tLoss: 0.249\tAccuracy: 0.824\n",
      "Epoch = 97/100\tLoss: 0.233\tAccuracy: 0.840\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>epoch</th>\n",
       "      <th>loss</th>\n",
       "      <th>accuracy</th>\n",
       "      <th>average_loss</th>\n",
       "      <th>average_accuracy</th>\n",
       "      <th>best_particle_hidden_num</th>\n",
       "      <th>best_particle_hidden_dim</th>\n",
       "      <th>best_particle_lr</th>\n",
       "      <th>best_err</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.113486</td>\n",
       "      <td>0.836</td>\n",
       "      <td>0.794905</td>\n",
       "      <td>0.556937</td>\n",
       "      <td>2.0</td>\n",
       "      <td>64.0</td>\n",
       "      <td>0.008600</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.211264</td>\n",
       "      <td>0.840</td>\n",
       "      <td>0.698659</td>\n",
       "      <td>0.637438</td>\n",
       "      <td>3.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.013007</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.141335</td>\n",
       "      <td>0.849</td>\n",
       "      <td>0.687492</td>\n",
       "      <td>0.622938</td>\n",
       "      <td>2.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.014776</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.209141</td>\n",
       "      <td>0.838</td>\n",
       "      <td>0.879604</td>\n",
       "      <td>0.498875</td>\n",
       "      <td>2.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.007382</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.827411</td>\n",
       "      <td>0.710</td>\n",
       "      <td>1.045667</td>\n",
       "      <td>0.397375</td>\n",
       "      <td>10.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0.005178</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>95.0</td>\n",
       "      <td>0.306693</td>\n",
       "      <td>0.823</td>\n",
       "      <td>0.916986</td>\n",
       "      <td>0.492500</td>\n",
       "      <td>2.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.005688</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>96.0</td>\n",
       "      <td>0.233255</td>\n",
       "      <td>0.840</td>\n",
       "      <td>0.933226</td>\n",
       "      <td>0.462937</td>\n",
       "      <td>2.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.005919</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>97.0</td>\n",
       "      <td>0.201262</td>\n",
       "      <td>0.844</td>\n",
       "      <td>0.867920</td>\n",
       "      <td>0.534188</td>\n",
       "      <td>2.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.005362</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>98.0</td>\n",
       "      <td>0.225293</td>\n",
       "      <td>0.839</td>\n",
       "      <td>0.867664</td>\n",
       "      <td>0.513437</td>\n",
       "      <td>2.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.005344</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99.0</td>\n",
       "      <td>0.277764</td>\n",
       "      <td>0.840</td>\n",
       "      <td>0.795244</td>\n",
       "      <td>0.575188</td>\n",
       "      <td>4.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.012476</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    epoch      loss  accuracy  average_loss  average_accuracy  \\\n",
       "0     0.0  0.113486     0.836      0.794905          0.556937   \n",
       "1     1.0  0.211264     0.840      0.698659          0.637438   \n",
       "2     2.0  0.141335     0.849      0.687492          0.622938   \n",
       "3     3.0  0.209141     0.838      0.879604          0.498875   \n",
       "4     4.0  0.827411     0.710      1.045667          0.397375   \n",
       "..    ...       ...       ...           ...               ...   \n",
       "95   95.0  0.306693     0.823      0.916986          0.492500   \n",
       "96   96.0  0.233255     0.840      0.933226          0.462937   \n",
       "97   97.0  0.201262     0.844      0.867920          0.534188   \n",
       "98   98.0  0.225293     0.839      0.867664          0.513437   \n",
       "99   99.0  0.277764     0.840      0.795244          0.575188   \n",
       "\n",
       "    best_particle_hidden_num  best_particle_hidden_dim  best_particle_lr  \\\n",
       "0                        2.0                      64.0          0.008600   \n",
       "1                        3.0                      50.0          0.013007   \n",
       "2                        2.0                      50.0          0.014776   \n",
       "3                        2.0                      50.0          0.007382   \n",
       "4                       10.0                      16.0          0.005178   \n",
       "..                       ...                       ...               ...   \n",
       "95                       2.0                      45.0          0.005688   \n",
       "96                       2.0                      50.0          0.005919   \n",
       "97                       2.0                      50.0          0.005362   \n",
       "98                       2.0                      50.0          0.005344   \n",
       "99                       4.0                      50.0          0.012476   \n",
       "\n",
       "    best_err  \n",
       "0        0.0  \n",
       "1        0.0  \n",
       "2        0.0  \n",
       "3        0.0  \n",
       "4        0.0  \n",
       "..       ...  \n",
       "95       0.0  \n",
       "96       0.0  \n",
       "97       0.0  \n",
       "98       0.0  \n",
       "99       0.0  \n",
       "\n",
       "[100 rows x 9 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cfg['EXP'] = 'PubMed'\n",
    "main(exp_name=cfg['EXP'])"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### CiteSeer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-----Current Experiment: CiteSeer-----\n",
      "       name  num_classes  num_features  num_edge_features  num_node_features\n",
      "0  CiteSeer            6          3703                  0               3703\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5393b42d31564dc6a6fa357ff8ca6a9e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/100 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch = 1/100\tLoss: 0.173\tAccuracy: 0.715\n",
      "Epoch = 5/100\tLoss: 0.204\tAccuracy: 0.691\n",
      "Epoch = 9/100\tLoss: 0.099\tAccuracy: 0.711\n",
      "Epoch = 13/100\tLoss: 0.124\tAccuracy: 0.713\n",
      "Epoch = 17/100\tLoss: 0.561\tAccuracy: 0.690\n",
      "Epoch = 21/100\tLoss: 0.268\tAccuracy: 0.705\n",
      "Epoch = 25/100\tLoss: 0.320\tAccuracy: 0.733\n",
      "Epoch = 29/100\tLoss: 0.788\tAccuracy: 0.754\n",
      "Epoch = 33/100\tLoss: 0.332\tAccuracy: 0.750\n",
      "Epoch = 37/100\tLoss: 0.530\tAccuracy: 0.723\n",
      "Epoch = 41/100\tLoss: 0.073\tAccuracy: 0.737\n",
      "Epoch = 45/100\tLoss: 0.234\tAccuracy: 0.706\n",
      "Epoch = 49/100\tLoss: 0.212\tAccuracy: 0.742\n",
      "Epoch = 53/100\tLoss: 0.196\tAccuracy: 0.742\n",
      "Epoch = 57/100\tLoss: 0.264\tAccuracy: 0.724\n",
      "Epoch = 61/100\tLoss: 0.552\tAccuracy: 0.681\n",
      "Epoch = 65/100\tLoss: 0.035\tAccuracy: 0.727\n",
      "Epoch = 69/100\tLoss: 0.038\tAccuracy: 0.720\n",
      "Epoch = 73/100\tLoss: 0.750\tAccuracy: 0.641\n",
      "Epoch = 77/100\tLoss: 1.090\tAccuracy: 0.509\n",
      "Epoch = 81/100\tLoss: 0.286\tAccuracy: 0.744\n",
      "Epoch = 85/100\tLoss: 0.297\tAccuracy: 0.724\n",
      "Epoch = 89/100\tLoss: 0.496\tAccuracy: 0.689\n",
      "Epoch = 93/100\tLoss: 0.062\tAccuracy: 0.738\n",
      "Epoch = 97/100\tLoss: 0.034\tAccuracy: 0.732\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>epoch</th>\n",
       "      <th>loss</th>\n",
       "      <th>accuracy</th>\n",
       "      <th>average_loss</th>\n",
       "      <th>average_accuracy</th>\n",
       "      <th>best_particle_hidden_num</th>\n",
       "      <th>best_particle_hidden_dim</th>\n",
       "      <th>best_particle_lr</th>\n",
       "      <th>best_err</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.173164</td>\n",
       "      <td>0.715</td>\n",
       "      <td>1.360007</td>\n",
       "      <td>0.367563</td>\n",
       "      <td>3.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>0.003500</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.655662</td>\n",
       "      <td>0.667</td>\n",
       "      <td>1.159834</td>\n",
       "      <td>0.435688</td>\n",
       "      <td>6.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0.009917</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.033249</td>\n",
       "      <td>0.720</td>\n",
       "      <td>1.043653</td>\n",
       "      <td>0.443063</td>\n",
       "      <td>2.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0.009285</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.154692</td>\n",
       "      <td>0.717</td>\n",
       "      <td>1.377313</td>\n",
       "      <td>0.338875</td>\n",
       "      <td>4.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>0.005098</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.203796</td>\n",
       "      <td>0.691</td>\n",
       "      <td>1.544398</td>\n",
       "      <td>0.288062</td>\n",
       "      <td>5.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>0.002826</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>95.0</td>\n",
       "      <td>0.159115</td>\n",
       "      <td>0.720</td>\n",
       "      <td>1.303240</td>\n",
       "      <td>0.360938</td>\n",
       "      <td>3.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0.003693</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>96.0</td>\n",
       "      <td>0.033584</td>\n",
       "      <td>0.732</td>\n",
       "      <td>1.203870</td>\n",
       "      <td>0.399938</td>\n",
       "      <td>2.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>0.005115</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>97.0</td>\n",
       "      <td>0.057524</td>\n",
       "      <td>0.727</td>\n",
       "      <td>1.157738</td>\n",
       "      <td>0.408500</td>\n",
       "      <td>2.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>0.004647</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>98.0</td>\n",
       "      <td>0.311278</td>\n",
       "      <td>0.727</td>\n",
       "      <td>1.299925</td>\n",
       "      <td>0.402875</td>\n",
       "      <td>4.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0.002878</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99.0</td>\n",
       "      <td>0.146777</td>\n",
       "      <td>0.741</td>\n",
       "      <td>1.401131</td>\n",
       "      <td>0.334125</td>\n",
       "      <td>2.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0.005793</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    epoch      loss  accuracy  average_loss  average_accuracy  \\\n",
       "0     0.0  0.173164     0.715      1.360007          0.367563   \n",
       "1     1.0  0.655662     0.667      1.159834          0.435688   \n",
       "2     2.0  0.033249     0.720      1.043653          0.443063   \n",
       "3     3.0  0.154692     0.717      1.377313          0.338875   \n",
       "4     4.0  0.203796     0.691      1.544398          0.288062   \n",
       "..    ...       ...       ...           ...               ...   \n",
       "95   95.0  0.159115     0.720      1.303240          0.360938   \n",
       "96   96.0  0.033584     0.732      1.203870          0.399938   \n",
       "97   97.0  0.057524     0.727      1.157738          0.408500   \n",
       "98   98.0  0.311278     0.727      1.299925          0.402875   \n",
       "99   99.0  0.146777     0.741      1.401131          0.334125   \n",
       "\n",
       "    best_particle_hidden_num  best_particle_hidden_dim  best_particle_lr  \\\n",
       "0                        3.0                      33.0          0.003500   \n",
       "1                        6.0                      22.0          0.009917   \n",
       "2                        2.0                      44.0          0.009285   \n",
       "3                        4.0                      41.0          0.005098   \n",
       "4                        5.0                      40.0          0.002826   \n",
       "..                       ...                       ...               ...   \n",
       "95                       3.0                      28.0          0.003693   \n",
       "96                       2.0                      40.0          0.005115   \n",
       "97                       2.0                      32.0          0.004647   \n",
       "98                       4.0                      22.0          0.002878   \n",
       "99                       2.0                      16.0          0.005793   \n",
       "\n",
       "    best_err  \n",
       "0        0.0  \n",
       "1        0.0  \n",
       "2        0.0  \n",
       "3        0.0  \n",
       "4        0.0  \n",
       "..       ...  \n",
       "95       0.0  \n",
       "96       0.0  \n",
       "97       0.0  \n",
       "98       0.0  \n",
       "99       0.0  \n",
       "\n",
       "[100 rows x 9 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cfg['EXP'] = 'CiteSeer'\n",
    "main(exp_name=cfg['EXP'])"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Results Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_time_best_accuracy_cora = []\n",
    "all_time_best_loss_cora = []\n",
    "all_time_best_accuracy_pubmed = []\n",
    "all_time_best_loss_pubmed = []\n",
    "all_time_best_accuracy_proteins = []\n",
    "all_time_best_loss_proteins = []\n",
    "all_time_best_accuracy_enzymes = []\n",
    "all_time_best_loss_enzymes = []\n",
    "tmp_best_accuracy = 0.0\n",
    "tmp_best_loss = 1000.0\n",
    "\n",
    "for index, row in df_cora.iterrows():\n",
    "    if float(row['accuracy']) > tmp_best_accuracy:\n",
    "        tmp_best_accuracy = float(row['accuracy'])\n",
    "    if float(row['loss']) < tmp_best_loss:\n",
    "        tmp_best_loss = float(row['loss'])\n",
    "    all_time_best_accuracy_cora.append(tmp_best_accuracy)\n",
    "    all_time_best_loss_cora.append(tmp_best_loss)\n",
    "\n",
    "tmp_best_accuracy = 0.0\n",
    "tmp_best_loss = 1000.0\n",
    "\n",
    "for index, row in df_pubmed.iterrows():\n",
    "    if float(row['accuracy']) > tmp_best_accuracy:\n",
    "        tmp_best_accuracy = float(row['accuracy'])\n",
    "    if float(row['loss']) < tmp_best_loss:\n",
    "        tmp_best_loss = float(row['loss'])\n",
    "    all_time_best_accuracy_pubmed.append(tmp_best_accuracy)\n",
    "    all_time_best_loss_pubmed.append(tmp_best_loss)\n",
    "\n",
    "tmp_best_accuracy = 0.0\n",
    "\n",
    "for index, row in df_proteins.iterrows():\n",
    "    if float(row['accuracy']) > tmp_best_accuracy:\n",
    "        tmp_best_accuracy = float(row['accuracy'])\n",
    "    if float(row['loss']) < tmp_best_loss:\n",
    "        tmp_best_loss = float(row['loss'])\n",
    "    all_time_best_accuracy_proteins.append(tmp_best_accuracy)\n",
    "    all_time_best_loss_proteins.append(tmp_best_loss)\n",
    "\n",
    "tmp_best_accuracy = 0.0\n",
    "tmp_best_loss = 1000.0\n",
    "\n",
    "for index, row in df_enzymes.iterrows():\n",
    "    if float(row['accuracy']) > tmp_best_accuracy:\n",
    "        tmp_best_accuracy = float(row['accuracy'])\n",
    "    if float(row['loss']) < tmp_best_loss:\n",
    "        tmp_best_loss = float(row['loss'])\n",
    "    all_time_best_accuracy_enzymes.append(tmp_best_accuracy)\n",
    "    all_time_best_loss_enzymes.append(tmp_best_loss)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_cora['epoch'], all_time_best_accuracy_cora, label = \"CORA accuracy\", color=\"black\")\n",
    "plt.plot(df_pubmed['epoch'], all_time_best_accuracy_pubmed, label = \"PUBMED accuracy\", color=\"blue\")\n",
    "plt.plot(df_proteins['epoch'], all_time_best_accuracy_proteins, label = \"PROTEINS accuracy\", color=\"red\")\n",
    "plt.plot(df_enzymes['epoch'], all_time_best_accuracy_enzymes, label = \"ENZYMES accuracy\", color=\"green\")\n",
    "# plt.plot(df_cora['epoch'], all_time_best_loss, label = \"loss\", color=\"red\")\n",
    "plt.title('evolution of historical best accuracy')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('accuracy')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_cora['epoch'], all_time_best_loss_cora, label = \"CORA loss\", color=\"black\")\n",
    "plt.plot(df_cora['epoch'], all_time_best_loss_pubmed, label = \"PUBMED loss\", color=\"blue\")\n",
    "plt.plot(df_proteins['epoch'], all_time_best_loss_proteins, label = \"PROTEINS loss\", color=\"red\")\n",
    "plt.plot(df_enzymes['epoch'], all_time_best_loss_enzymes, label = \"ENZYMES loss\", color=\"green\")\n",
    "# plt.plot(df_cora['epoch'], all_time_best_loss, label = \"loss\", color=\"red\")\n",
    "plt.title('evolution of historical best loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('loss')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_time_best_average_accuracy_cora = []\n",
    "all_time_best_average_loss_cora = []\n",
    "all_time_best_average_accuracy_pubmed = []\n",
    "all_time_best_average_loss_pubmed = []\n",
    "all_time_best_average_accuracy_proteins = []\n",
    "all_time_best_average_loss_proteins = []\n",
    "all_time_best_average_accuracy_enzymes = []\n",
    "all_time_best_average_loss_enzymes = []\n",
    "tmp_best_average_accuracy = 0.0\n",
    "tmp_best_average_loss = 1000.0\n",
    "\n",
    "for index, row in df_cora.iterrows():\n",
    "    if float(row['average_accuracy']) > tmp_best_average_accuracy:\n",
    "        tmp_best_average_accuracy = float(row['average_accuracy'])\n",
    "    if float(row['average_loss']) < tmp_best_average_loss:\n",
    "        tmp_best_average_loss = float(row['average_loss'])\n",
    "    all_time_best_average_accuracy_cora.append(tmp_best_average_accuracy)\n",
    "    all_time_best_average_loss_cora.append(tmp_best_average_loss)\n",
    "\n",
    "tmp_best_average_accuracy = 0.0\n",
    "tmp_best_average_loss = 1000.0\n",
    "\n",
    "for index, row in df_pubmed.iterrows():\n",
    "    if float(row['average_accuracy']) > tmp_best_average_accuracy:\n",
    "        tmp_best_average_accuracy = float(row['average_accuracy'])\n",
    "    if float(row['average_loss']) < tmp_best_average_loss:\n",
    "        tmp_best_average_loss = float(row['average_loss'])\n",
    "    all_time_best_average_accuracy_pubmed.append(tmp_best_average_accuracy)\n",
    "    all_time_best_average_loss_pubmed.append(tmp_best_average_loss)\n",
    "\n",
    "tmp_best_average_accuracy = 0.0\n",
    "\n",
    "for index, row in df_proteins.iterrows():\n",
    "    if float(row['average_accuracy']) > tmp_best_average_accuracy:\n",
    "        tmp_best_average_accuracy = float(row['average_accuracy'])\n",
    "    if float(row['average_loss']) < tmp_best_average_loss:\n",
    "        tmp_best_average_loss = float(row['average_loss'])\n",
    "    all_time_best_average_accuracy_proteins.append(tmp_best_average_accuracy)\n",
    "    all_time_best_average_loss_proteins.append(tmp_best_average_loss)\n",
    "\n",
    "tmp_best_average_accuracy = 0.0\n",
    "tmp_best_average_loss = 1000.0\n",
    "\n",
    "for index, row in df_enzymes.iterrows():\n",
    "    if float(row['average_accuracy']) > tmp_best_average_accuracy:\n",
    "        tmp_best_average_accuracy = float(row['average_accuracy'])\n",
    "    if float(row['average_loss']) < tmp_best_average_loss:\n",
    "        tmp_best_average_loss = float(row['average_loss'])\n",
    "    all_time_best_average_accuracy_enzymes.append(tmp_best_average_accuracy)\n",
    "    all_time_best_average_loss_enzymes.append(tmp_best_average_loss)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_cora['epoch'], all_time_best_average_accuracy_cora, label = \"CORA average accuracy\", color=\"black\")\n",
    "plt.plot(df_pubmed['epoch'], all_time_best_average_accuracy_pubmed, label = \"PUBMED average accuracy\", color=\"blue\")\n",
    "plt.plot(df_proteins['epoch'], all_time_best_average_accuracy_proteins, label = \"PROTEINS average accuracy\", color=\"red\")\n",
    "plt.plot(df_enzymes['epoch'], all_time_best_average_accuracy_enzymes, label = \"ENZYMES average accuracy\", color=\"green\")\n",
    "plt.title('evolution of historical best average_accuracy')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average_accuracy')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_cora['epoch'], all_time_best_average_loss_cora, label = \"CORA average_loss\", color=\"black\")\n",
    "plt.plot(df_pubmed['epoch'], all_time_best_average_loss_pubmed, label = \"PUBMED average_loss\", color=\"blue\")\n",
    "plt.plot(df_proteins['epoch'], all_time_best_average_loss_proteins, label = \"PROTEINS average_loss\", color=\"red\")\n",
    "plt.plot(df_enzymes['epoch'], all_time_best_average_loss_enzymes, label = \"ENZYMES average_loss\", color=\"green\")\n",
    "plt.title('evolution of historical best average_loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average_loss')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_cora['epoch'], df_cora[\"average_accuracy\"], label = \"CORA average accuracy\", color=\"black\")\n",
    "plt.title('evolution of average accuracy')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average accuracy')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_cora['epoch'], df_cora[\"average_loss\"], label = \"CORA average loss\", color=\"black\")\n",
    "plt.title('evolution of average loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average loss')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_pubmed['epoch'], df_pubmed[\"average_accuracy\"], label = \"PUBMED average accuracy\", color=\"blue\")\n",
    "plt.title('evolution of average accuracy')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average accuracy')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_pubmed['epoch'], df_pubmed[\"average_loss\"], label = \"PUBMED average loss\", color=\"blue\")\n",
    "plt.title('evolution of average loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average loss')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_proteins['epoch'], df_proteins[\"average_accuracy\"], label = \"PROTEINS average accuracy\", color=\"red\")\n",
    "plt.title('evolution of average accuracy')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average accuracy')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_proteins['epoch'], df_proteins[\"average_loss\"], label = \"PROTEINS average loss\", color=\"red\")\n",
    "plt.title('evolution of average loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average loss')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_enzymes['epoch'], df_enzymes[\"average_accuracy\"], label = \"ENZYMES average accuracy\", color=\"green\")\n",
    "plt.title('evolution of average accuracy')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average accuracy')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.plot(df_enzymes['epoch'], df_enzymes[\"average_loss\"], label = \"ENZYMES average loss\", color=\"green\")\n",
    "plt.title('evolution of average loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.ylabel('average loss')\n",
    "plt.grid()\n",
    "plt.legend()\n",
    "plt.rcParams['figure.figsize'] = [10, 5]\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.13 ('hw': conda)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "747b0286689d47d2437887b3fa14bd59117dc06b2f96aae2ee6b23ff3c51c6b1"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
